<template>
    <div class="app-container">
        <el-row>
            <div style="font-size: 14px;color: #333;">填写商品链接，点击提交即可自动添加商品到商品列表；由于采集数据的不确定性，并非所有商品都能获取到，如获取失败请手动添加，如数据存在偏差请手动修改</div>
            <el-tabs v-model="activeName" @tab-click="handleClick">
                <el-tab-pane label="京东" name="first">
                    <el-form ref="rowForm" label-position="left" >
                        <el-form-item label="商品ID或商品链接：">
                            <el-input v-model="itemValue"></el-input>
                        </el-form-item>
                    </el-form>
                </el-tab-pane>
                <el-tab-pane label="淘宝" name="second">
                    <el-form ref="rowForm" label-position="left" >
                        <el-form-item label="商品ID或商品链接：">
                            <el-input v-model="itemValue"></el-input>
                        </el-form-item>
                    </el-form>
                </el-tab-pane>
                <el-tab-pane label="天猫" name="third">
                    <el-form ref="rowForm" label-position="left" >
                        <el-form-item label="商品ID或商品链接：">
                            <el-input v-model="itemValue"></el-input>
                        </el-form-item>
                    </el-form>
                </el-tab-pane>
                <el-tab-pane label="阿里巴巴" name="fourth">
                    <el-form ref="rowForm" label-position="left" >
                        <el-form-item label="商品ID或商品链接：">
                            <el-input v-model="itemValue"></el-input>
                        </el-form-item>
                    </el-form>
                </el-tab-pane>
            </el-tabs>
        </el-row>
        <div style="margin-top: 30px;width: 100%;display: flex;flex-direction: row;">
            <el-button type="primary" @click="submitForm" :loading="loading">提交</el-button>
        </div>
    </div>
</template>

<script>
export default {
    components: {  },
    data() {
        return {
            activeName: 'first',
            itemValue: '',
            loading: false,
        }
    },
    created(){
        
    },
    methods: {
        handleClick(tab, event) {
            console.log(tab, event);
        },
        submitForm(){
            this.loading = true
            this.request_post('/common/99api/getItemDetail/', {scene: 'jd', itemValue: this.itemValue}).then((res) => {
                this.loading = false
                if(res.data.code == 10001){
                    var _this = this
                    this.$confirm('采集成功，是否去编辑商品？', "", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning"
                    }).then(function () {
                        _this.$router.push({ name: 'CreateItem', query: { itemId: res.data.message } })
                    })
                }
            })
        }
    
    }
}
</script>

<style lang="scss" scoped>

</style>
